# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_realname=aiohappyeyeballs
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python-${_realname}")
pkgver=2.6.1
pkgrel=1
pkgdesc='Happy Eyeballs for asyncio (mingw-w64)'
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://aiohappyeyeballs.readthedocs.io/'
msys2_repository_url='https://github.com/aio-libs/aiohappyeyeballs/'
msys2_references=(
  'purl: pkg:pypi/aiohappyeyeballs'
)
license=('spdx: PSF-2.0')
depends=(
  "${MINGW_PACKAGE_PREFIX}-python"
)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-python-build"
  "${MINGW_PACKAGE_PREFIX}-python-installer"
  "${MINGW_PACKAGE_PREFIX}-python-poetry-core")
source=("https://pypi.org/packages/source/${_realname::1}/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('c3f9d0113123803ccadfdf3f0faa505bc78e6a72d1cc4806cbd719826e943558')

build() {
  cp -r "${_realname}-${pkgver}" "python-build-${MSYSTEM}" && cd "python-build-${MSYSTEM}"
  python -m build --wheel --skip-dependency-check --no-isolation
}

package() {
  cd "python-build-${MSYSTEM}"
  MSYS2_ARG_CONV_EXCL="--prefix=" \
    python -m installer --prefix=${MINGW_PREFIX} \
    --destdir="${pkgdir}" dist/*.whl
  install -Dm644 LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/python-${_realname}/LICENSE"
}
